package com.etc.controller;

import com.etc.entity.ViewRoomInfo;
import com.etc.service.ViewRoomInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("/viewRoomInfo")
public class ViewRoomInfoController {

    @Autowired
    ViewRoomInfoService service;

    /**
     * 查询所有房间
     * @return
     */
    @RequestMapping("/getAllRoom")
    @ResponseBody
    public List<ViewRoomInfo> getAllRoom(){
        List<ViewRoomInfo> list=service.getAllRoom();
        return list;
    }

    @RequestMapping("/getRoomByName")
    @ResponseBody
    public List<ViewRoomInfo> getRoomByName(@RequestParam("spc")String spc,@RequestParam("rtName")String rtName){
        List<ViewRoomInfo> list=service.getRoomInfo(spc,rtName);
        return list;
    }
}
